<?php
/** .-------------------------------------------------------------------
 * |  Software: [HDCMS framework]
 * |      Site: www.hdcms.com
 * |-------------------------------------------------------------------
 * |    Author: 向军 <2300071698@qq.com>
 * |    WeChat: aihoudun
 * | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved.
 * '-------------------------------------------------------------------*/

namespace web\home\controller;

class Center{
    //动作
	public function index(){
		View::make();
	}
	public function address(){
	    View::make();
    }
    public function collect(){
        $gids = Db::table('collect')->where('uid',$_SESSION['home']['uid'])->lists('gid');
        $goodsData = Db::table('goods')->whereIn('gid',$gids)->get();
//        p($goodsData);
        View::with('goodsData',$goodsData);
        View::make();
    }
    public function ajaxCollect(){
        $gid = $_POST['gid'];
//        p($gid);
        Db::table('collect')->where('uid',$_SESSION['home']['uid'])->where('gid',$gid)->delete();
//        p($data);
        echo json_encode(['val'=>1]);exit;

    }
}
